import { Router } from 'express';
import { authenticate } from '../middlewares/auth';
import {
  getDiscussions,
  getDiscussionById,
  createDiscussion,
  createReply,
} from '../controllers/discussion.controller';

const router = Router();

// 公开路由
router.get('/', getDiscussions);
router.get('/:id', getDiscussionById);

// 需要认证的路由
router.post('/', authenticate, createDiscussion);
router.post('/:id/replies', authenticate, createReply);

export default router;
